package com.module.base.network.exception

import com.module.base.network.ERROR
import java.io.Serializable

/**
 * 异常处理
 */
class ServerException(message: String?, code: Int) : Exception(), Serializable {
    var code: Int = 0
    var msg: String?
    var e: Throwable? = null

    init {
        this.code = code
        this.msg = message
        //由于父类message无法二次赋值
//        this.message
    }

    /**
     * 次构造函数
     */
    constructor(throwable: Throwable, code: Int) : this(throwable.message.toString(), code)
}

fun emptyException(): ServerException? {
    return ServerException("暂无内容", ERROR.EMPTY)
}
